<?php
class template
{
	static private $style;
	static private $css;
	static private $php_code;
	static private $javascript_code;
	
	static function init()
	{
			$db = db::getDbIstance();
			$res = $db->query("SELECT templateid FROM template WHERE templatename = '".config::getconfig('_theme')."'");
			list($templateid) = $db->fetch_row($res);
			$res2 = $db->query("SELECT stylename, stylevalue, styletype FROM style WHERE templateid = '$templateid'");
			while(list($stylename, $stylevalue, $styletype) = $db->fetch_row($res2))
			{
				switch ($styletype)
				{
					case "css":
						self::$css[$stylename] = $stylevalue;
					break;
					case "style":
						self::$style[$stylename] = $stylevalue;
					break;
					case "php_code":
						self::$php_code[$stylename] = $stylevalue;
					break;
					case "javascript_code":
						self::$javascript_code[$stylename] = $stylevalue;
					break;
					
				}
			}
	}
	
	
	static function getStyle($name)
	{
		return self::$style[$name];
	}
	static function getCss($name)
	{
		return self::$css[$name];
	}
	static function getPhp_code($name)
	{
		return self::$php_code[$name];
	}
	static function getJavascript_code($name)
	{
		return self::$javascript_code[$name];
	}
}
?>